<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改员工每月成本')" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-payroll-edit" th:object="${payroll}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">姓名：</label>
                <div class="col-sm-8">
                    <select name="userId"  class="form-control m-b" disabled th:field="*{userId}" th:with="type=${@customDictService.selectUserList()}">
                        <option value="0">无</option>
                        <option th:each="dict : ${type}" th:text="${dict.userName}" th:value="${dict.userId}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">年份：</label>
                <div class="col-sm-8">
                    <input name="year" id="year" th:field="*{year}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">月份：</label>
                <div class="col-sm-8">
                    <input name="month" id="month" th:field="*{month}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">税前工资：</label>
                <div class="col-sm-8">
                    <input name="salary" id="salary" th:field="*{salary}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">公司社保：</label>
                <div class="col-sm-8">
                    <input name="insurance" id="insurance" th:field="*{insurance}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">公司公积金：</label>
                <div class="col-sm-8">
                    <input name="accumulationFund" id="accumulationFund" th:field="*{accumulationFund}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">费用-代理：</label>
                <div class="col-sm-8">
                    <input name="proxyFee" id="proxyFee" th:field="*{proxyFee}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">费用-账期：</label>
                <div class="col-sm-8">
                    <input name="billFee" id="billFee" th:field="*{billFee}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">电脑费用：</label>
                <div class="col-sm-8">
                    <input name="computerFee" id="computerFee" th:field="*{computerFee}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">提成/奖金：</label>
                <div class="col-sm-8">
                    <input name="bonusFee" id="bonusFee" th:field="*{bonusFee}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">报销：</label>
                <div class="col-sm-8">
                    <input name="expenseFee" id="expenseFee" th:field="*{expenseFee}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">其他费用：</label>
                <div class="col-sm-8">
                    <input name="otherFee" id="otherFee" th:field="*{otherFee}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">共计成本：</label>
                <div class="col-sm-8">
                    <input name="totalFee" th:field="*{totalFee}" disabled class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var prefix = ctx + "erp/payroll";
        $("#form-payroll-edit").validate({
            focusCleanup: true,
            rules:{
                month:{
                    min:1,
                    max:12,
                    digits: true
                },
                year:{
                    min: 1960,
                    max: 2100,
                    digits: true
                },
                salary:{
                    number: true
                },
                insurance:{
                    number: true
                },
                accumulationFund:{
                    number: true
                },
                proxyFee:{
                    number: true
                },
                billFee:{
                    number: true
                },
                actulBillFee:{
                    number: true
                },
                computerFee:{
                    number: true
                },
                bonusFee:{
                    number: true
                },
                expenseFee:{
                    number: true
                },
                salary:{
                    number: true
                }
            }
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-payroll-edit').serialize());
            }
        }
    </script>
</body>
</html>